const express=require('express')
const pool=require('../pool')
const router=express.Router()
module.exports=router
// 拍卖会列表
router.get('/list',(req,res,next)=>{
	let {pno,pagenum} = req.query
	pagenum = pagenum ? Number(pagenum) : 10
	const start = (pno-1)*pagenum
	pool.query('SELECT count(*) count FROM auction',(err,count)=>{
		if(err){
			next(err)
			return
		}
		pool.query('SELECT atime,perf,asite,p_count,p_tatol FROM auction LIMIT ?,?',[start,pagenum],(err,result)=>{
			if(err){
				next(err)
				return 
			}
			res.send({code:200,msg:'操作成功',result,count:count[0].count,pno:Number(pno),pageCount:count[0].count/pagenum})
		})

	})
})